package com.tyj.movie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tyj.movie.entity.MovieActor;
import com.tyj.movie.mapper.MovieActorMapper;
import com.tyj.movie.service.MovieActorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author tyj
 * @since 2021-06-28
 */
@Service
public class MovieActorServiceImpl extends ServiceImpl<MovieActorMapper, MovieActor> implements MovieActorService {

    @Autowired
    MovieActorMapper movieActorMapper;

    @Override
    public Page<MovieActor> actorPagingQuery(Long pageNum) {
        Page<MovieActor> page =movieActorMapper.selectPage(new Page<MovieActor>(pageNum,5),new QueryWrapper<MovieActor>().orderByDesc("create_date"));
        for (MovieActor record : page.getRecords()) {
            Date createDate = record.getCreateDate();
            SimpleDateFormat simpleDateFormat=new SimpleDateFormat("");
            simpleDateFormat.format(createDate);
        }
        return page;
    }
}
